package com.test.map;

import java.awt.geom.Point2D;
import java.util.ArrayList;
import java.util.List;

import com.test.game.tiles.HexagonalTile;
import com.test.jogl.HexagonalTileUI;

public class MapCoordinatesGenerator {

   public static List<HexagonalTileUI> compute(List<List<HexagonalTile>> matrix, double radius) {
      int xAbsolute = 0, yAbsolute = 0;
      float x = 0.0F, y = 0.0F;
      float twoRadius = (float)(radius * 2.0);
      List<HexagonalTileUI> lst = new ArrayList<HexagonalTileUI>();
      for (List<HexagonalTile> list : matrix) {
         xAbsolute = 0;
         for (HexagonalTile hexagonalTile : list) {
            if(!hexagonalTile.isEmptyTile()) {
               x = xAbsolute * twoRadius;
               y = yAbsolute * twoRadius;
               lst.add(new HexagonalTileUI(hexagonalTile, new Point2D.Float(x, y)));
               System.out.println("" + new Point2D.Float(x, y));
            }
            xAbsolute++;
         }
         yAbsolute--;
      }
      return lst;
   }
}
